<?
/*
 * Copyright 2004-2005 Sigve Indregard.
 *
 * This file is part of Laivsys.
 *
 * Laivsys is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Laivsys is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Laivsys; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/*
 * $Id: arrindex.php 6 2005-07-11 23:14:47Z say $
 */
 
include_once("db.php");
include_once("laivid.php");
include_once("design.php");

$id = $_SESSION['laivID'];

$arr=getLaiv();
$sidetittel=$arr['Tittel'];
include("top.php");

headline('Innledning');
text($arr['Beskrivelse']);

//stikkord
headline("Stikkord");

$stikk="<table>\n";
$sql = "SELECT * FROM Stikkord WHERE LaivID={$_SESSION['laivID']} ORDER BY Posisjon";
$stikkord=mysql_query($sql);

while ($ord = mysql_fetch_assoc($stikkord)) {
	$stikk .= "<tr>\n";
	$stikk .= "<th>{$ord['Tittel']}</th>\n";
	$stikk .= "<td>".txt2html($ord['Tekst'])."</td>\n";
	$stikk .= "</tr>\n";
}
$stikk .= "</table>\n";
text($stikk, false);

//menu
headline("Meny");

$meny = "<table>\n";

if ($arr['pam_Startet'] && $arr['pam_Sluttet']) {
	$meny .= menuitem("meldpaa.gif", "P�melding", "P�meldingen til dette arrangementet er stengt.", "");
} elseif ($arr['pam_Startet'] && !$arr['pam_Sluttet']) {
	$meny .= menuitem("meldpaa.gif", "P�melding", "Send inn en s�knad om � f� v�re med p� laiv!", "pamelding.php");
} else {
	$meny .= menuitem("meldpaa.gif", "P�melding", "P�meldingen �pner ikke f�r ".isodateformat($arr['Pamelding_start']), "");
}


$meny .= menuitem("meldpaa.gif", "Innlogging", "Logg inn for � sjekke om du er tatt med, og laste ned rollebeskrivelse, kompendier og annet din rollekarakter vet om.", "nettsvar.php");

$meny .= menuitem("dokumenter.gif", "Dokumenter", "Felleskompendier, spilleregler og andre dokumenter", "dokumenter.php");

$meny .= menuitem("ukjent.gif", "Etter laiven", "Bilder, dokumenter og annet fra laiven", "postlaiv.php");

$meny .= "</table>\n";

text($meny, false);


//news


include("bottom.php");

function menuitem ($bilde, $tittel, $tekst, $link) {
	if (!empty($link)) {
		$linktxtstart="<a href=\"$link\">";
		$linktxtend="</a>";
		$linket=true;
	} else {
		$linktxtstart="";
		$linktxtend="";
		$linket=false;
	}
	$retur = "<tr>\n";
	
	$retur .= "<td rowspan=\"2\">\n";
	if ($linket) $retur .= $linktxtstart;
	$retur .= "<img src=\"$bilde\" border=\"0\" width=\"48\" height=\"48\"/>";
	if ($linket) $retur .= $linktxtend;
	$retur .= "</td>\n";

	$retur .= "<th class=\"special\"><b>$linktxtstart$tittel$linktxtend</b></th>\n";
	$retur .= "</tr>\n<tr>\n";
	$retur .= "<td><em>$tekst</em></td>\n";
	$retur .= "</tr>\n";

	return $retur;
}
?>
